﻿using System;
using System.Data;
using System.Text;
using System.Data.SqlClient;
using OA.DBUtility;
using OA.Model;
using System.Collections.Generic;

namespace OA.Manager
{
	/// <summary>
	/// 数据访问类:Reward
	/// </summary>
	public partial class RewardManager
	{
		private SqlService<RewardInfo> _sqlService = null;

        public RewardManager()
		{
            _sqlService = new SqlService<RewardInfo>();
        }

		#region  Method		

        /// <summary>
        /// 插入新记录
        /// </summary>
        /// <param name="rewardInfo"></param>
        /// <returns></returns>
        public bool InsertRewardInfo(RewardInfo rewardInfo)
        {
            return _sqlService.SaveEntity(rewardInfo);
        }

        /// <summary>
        /// 根据打印任务ID获得打印任务信息
        /// </summary>
        /// <param name="taskID"></param>
        /// <returns></returns>
        public RewardInfo GetRewardInfoByID(int ID)
        {
            Dictionary<string, object> dic = new Dictionary<string, object>();
            dic.Add("ID", ID);
            return _sqlService.GetSingleByFields(dic, null);
        }

        /// <summary>
        /// 判断该打印任务是否存在
        /// </summary>
        /// <param name="rewardInfo"></param>
        /// <returns></returns>
        public bool IsExistRewardInfo(RewardInfo rewardInfo)
        {
            return _sqlService.IsExist(rewardInfo);
        }

        /// <summary>
        /// 根据指定的字段更新，字段名是数据库中对应的名称
        /// </summary>
        /// <param name="rewardInfo"></param>
        /// <param name="needUpdateFields"></param>
        /// <returns></returns>
        public bool UpdateRewardInfo(RewardInfo rewardInfo, List<string> needUpdateFields)
        {
            return _sqlService.UpdateByFields(rewardInfo, needUpdateFields);
        }

        /// <summary>
        /// 删除该检查任务
        /// </summary>
        /// <param name="rewardInfo"></param>
        /// <returns></returns>
        public bool DeleteRewardInfo(RewardInfo rewardInfo)
        {
            return _sqlService.DeleteEntity(rewardInfo);
        }
		
		#endregion  Method
	}
}

